<?php
/**
 *通知公告
 */
namespace app\index\controller;

use app\common\model\Notice as Ni;
class NotsController extends BaseController{
    private $foot;
    public function _initialize(){
        $this->foot=$this->foot();
    }

    public function lst(){
		$this->assign([
			'notices'=>Ni::where('status','eq',1)->order(['sort'=>'desc'])->select(),
            'foot'=>$this->foot
		]);
		return $this->fetch();	
	}
	//公告详情
	public function detail(){
		$info=array();
		$i=$this->request->param('id');
		$data=Ni::field('id,frequency')->find($i);
		$data['frequency'] +=1;
		$info['frequency']=$data['frequency'];
		(new Ni() )->allowField(true)->save($info,['id'=>$i]);

		$this->assign([
			'details'=>Ni::find($i)
		]);
		return $this->fetch();
	}
}